package com.learn.demo.http.service;

import com.dtflys.forest.annotation.BaseRequest;
import com.dtflys.forest.annotation.DataObject;
import com.dtflys.forest.annotation.DataParam;
import com.dtflys.forest.annotation.Request;
import com.dtflys.forest.http.ForestResponse;
import com.learn.demo.entity.User;
import com.learn.demo.interceptor.DemoInterceptor;
import org.springframework.stereotype.Service;

/**
 * @author banjiawei
 * @date 2020/08/24
 * 使用forest调用第三方接口
 */
@Service
@BaseRequest(interceptor = {DemoInterceptor.class})
public interface ForestServiceDemo {

    @Request(url = "${demoUrl}/third/party/login",type = "POST")
    String testLogin(@DataParam("userName") String userName, @DataParam("pwd") String pwd);

    @Request(url = "${demoUrl}/third/party/login/user",type = "POST", contentType = "application/json")
    String testLogin(@DataObject User user);

    @Request(url = "${demoUrl}/third/party/login/timeout")
    ForestResponse<String> testLoginTimeout();
}
